import { createRouter, createWebHashHistory} from 'vue-router';  
import Home from '../views/Home.vue'; 
import Details from '../components/Details.vue'; 

import Products from '../views/Products.vue';  
import Orders from '../views/Orders.vue';  
import Users from '../views/Users.vue';  

import Login from '../components/Login.vue';  
import Register from '../components/Register.vue';  
import MyPage from '../components/MyPage.vue';  
  
const routes = [  
  {  
    path: '/',  
    name: 'Home',  
    component: Home  
  },
  {  
    path: '/details/:id',  
    name: 'Details',  
    component: Details,  
    props: true,  
  }, 
  
  {  
    path: '/products',  
    name: 'Products',  
    component: Products  
  },  
  {  
    path: '/orders',  
    name: 'Orders',  
    component: Orders  
  },  
  {  
    path: '/users',  
    name: 'Users',  
    component: Users  
  },  
  // 可以添加更多路由  
  {  
    path: '/login',  
    name: 'Login',  
    component: Login  
  },  
  {  
    path: '/register',  
    name: 'Register',  
    component: Register  
  },  
  {  
    path: '/my-page',  
    name: 'MyPage',  
    component: MyPage,  
    meta: { requiresAuth: true }  // 添加路由守卫  
  }  
];  
  
const router = createRouter({  
  history: createWebHashHistory(),  
  routes  
});  
  
export default router;